package memoryx

import (
	"github.com/tmc/langchaingo/callbacks"
	"github.com/tmc/langchaingo/memory"
)

type Options struct {
	callbacksHandler callbacks.Handler
	*memory.ConversationBuffer
	outParser

	prompt string

	messageTypeAi    string
	messageTypeHuman string
}

type Option func(*Options)

func applyChatSummaryOptions(opts ...Option) *Options {
	opt := &Options{
		callbacksHandler:   nil,
		ConversationBuffer: memory.NewConversationBuffer(),
		prompt:             _DEFAULT_SUMMARIZER_TEMPLATE,
		messageTypeAi:      "AI",
		messageTypeHuman:   "Human",
	}

	for _, o := range opts {
		o(opt)
	}

	return opt
}

func WithCallbacksHandler(callbacks callbacks.Handler) Option {
	return func(options *Options) {
		options.callbacksHandler = callbacks
	}
}

func WithConversationBuffer(v *memory.ConversationBuffer) Option {
	return func(options *Options) {
		options.ConversationBuffer = v
	}
}

func WithOutParser(v outParser) Option {
	return func(options *Options) {
		options.outParser = v
	}
}

func WithPrompt(prompt string) Option {
	return func(options *Options) {
		options.prompt = prompt
	}
}

func WithMessageTypeAi(messageTypeAi string) Option {
	return func(options *Options) {
		options.messageTypeAi = messageTypeAi
	}
}

func WithMessageTypeHuman(messageTypeHuman string) Option {
	return func(options *Options) {
		options.messageTypeHuman = messageTypeHuman
	}
}
